package com.zhou.yygh.hosp.controller;

import com.zhou.yygh.common.result.Result;
import com.zhou.yygh.hosp.service.ScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import zhou.hospital.model.hosp.Schedule;


import java.util.Date;
import java.util.List;
import java.util.Map;


@RequestMapping("/admin/hosp/schedule")
@Api(tags = "排班管理")
@RestController
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;
    //根据医院编号，科室编号查询排班规则数据
    @ApiOperation(value = "查询排班数据")
    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable Long page,
                                  @PathVariable Long limit,
                                  @PathVariable String hoscode,
                                  @PathVariable String depcode) {
        Map<String,Object> map = scheduleService.getRuleSchedule(page,limit,hoscode,depcode);
        return Result.ok(map);
    }
   //根据医院编号，科室编号,工作日期，查询排班日期p
     @ApiOperation(value = "查询排班详细信息")
     @GetMapping("/getScheduleDetail/{hoscode}/{depcode}/{workDate}")
     public Result getScheduleRule(@PathVariable String hoscode,
                                   @PathVariable String depcode,
                                   @PathVariable String workDate){
      List<Schedule> scheduleList =  scheduleService.getDetailSchedule(hoscode,depcode,workDate);
      return    Result.ok(scheduleList);

     }

}
